/*
   组织架构 API接口
*/

import request from '@/utils/request'

/**
 * @description 获取组织架构数据
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department'
    // method: 'GET'
  })
}

/**
 * @description 获取下拉部门负责人数据
 * @returns
 */
export function getEmployeeSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * @description 添加子部门
 * @param {*} data
 * @returns
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * @description 获取部门详情
 * @param {*} id 表示当前编辑项的id
 * @returns
 */
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * @description 修改部门信息
 * @param {*} data
 * @returns
 */
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}

/**
 * @description 删除部门信息
 * @param {*} id
 * @returns
 */
export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
